<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {
		parent.$.messager.progress('close');

		$('#form').form({
			url : '/residenceController/dispatchProperty',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				try{
					parent.$.messager.progress('close');
					result = $.parseJSON(result);
					if (result.success) {
						parent.$.modalDialog.openner_dataGrid.datagrid('reload');
						parent.$.modalDialog.handler.dialog('close');
					} else {
						parent.$.messager.alert("提示",result.msg, 'info');
					}
				} catch(e){
						parent.$.messager.alert("提示",result, 'info');
				}
			}
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<input name="id" type="hidden" class="span2" value="${residence.id }" readonly="readonly"/>
			<table class="table table-hover table-condensed">
				<tr>
					<th>小区名字</th>
					<td><input name="name" type="text" placeholder="小区名"   style="width:380px" class="easyui-validatebox span2" data-options="required:true" value="${residence.name }" readonly="readonly"></td>
				</tr>
				<tr>
					<th>小区代码</th>
					<td><input name="code" type="text" placeholder="小区代码"   style="width:380px" required="required"  data-options="required:true" class="easyui-validatebox span2" value="${residence.code }" readonly="readonly"></td>
				</tr>
				<tr>
					<td>小区地址</td>
					<td colspan="3">
						<input name="address"  type="text" placeholder="小区地址"   style="width:380px" data-options="required:true" class="easyui-validatebox" value="${residence.address }" readonly="readonly"/>
					</td>
				</tr>
				<tr>
					<td>物业公司</td>
					<td colspan="3">
						<select  name="propertyId"  type="text" placeholder="小区地址"  class="easyui-combobox"  data-options="required:true,width:380,icons:[{
										iconCls:'icon-clear',
										handler: function(e){
											$(e.data.target).combobox('setValue','');
										}
									}]" >
								<c:forEach items="${propertyCompany }" var="company">
										<c:choose>
											<c:when test="${residence.propertyId == company.value }">
												<option value="${company.value }" selected="selected">${company.text }</option>
											</c:when>
											<c:otherwise>
												<option value="${company.value }" >${company.text }</option>
											</c:otherwise>
										</c:choose>
								</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<th>备注</th>
					<td colspan="3"><textarea name="remark" rows="" cols=""   style="width:380px" class="span5" readonly="readonly">${residence.remark }</textarea></td>
				</tr>
			</table>
		</form>
	</div>
</div>